import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'color/MyColor.dart';
class MyDetailCtrl extends StatefulWidget{
  MyDetailCtrl({Key key, this.title}) : super(key: key);
  final String title;
  @override
  State<StatefulWidget> createState() {
    return _MyDetailCtrlState();
  }
}

class _MyDetailCtrlState extends State<MyDetailCtrl> {

  @override
  Widget build(BuildContext context) {
    ScreenUtil.init(context, width: 750/2, height: 1334/2);

    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
        backgroundColor: MyColor.AppColor,
      ),
      body: new bodyContent(),
    );
  }
}
class bodyContent extends StatelessWidget{
  Widget build(BuildContext context){
    return new Container(
      margin: EdgeInsets.only(top: 0,left: 0),
      width: ScreenUtil.screenWidthDp,
      height: ScreenUtil.screenHeightDp,
      child: new Stack(
          children: <Widget>[
            leftContent(),
            rightContent(),
          ],
      ),
    );
  }
}
class leftContent extends StatelessWidget{
  void action(){

  }
  Widget build(BuildContext context){
    return new Container(
      margin: EdgeInsets.only(top: 0,left: 0),
      width: 200,
      height: 200,
      color: MyColor.AppColor,
      child: new Stack(
        children: <Widget>[
          Text("left view"),
          new Container(
            margin: EdgeInsets.only(top: 20,left: 0),
            width: 40,
            height: 40,
            color: MyColor.AppFFFFFF,
          ),
          new Container(
            margin: EdgeInsets.only(top: 20,left: 60),
            width: 40,
            height: 40,
            color: MyColor.AppFFFFFF,
          ),

          new Container(
            margin: EdgeInsets.only(top: 60,right: 0),
            width: 100,
            height: 40,
            child: new RaisedButton(onPressed: action,
              child: Text("title"),
            ),
          ),
        ],
      ),
    );
  }
}
class rightContent extends StatelessWidget{
  Widget build(BuildContext context){
    return new Container(
      margin: EdgeInsets.only(top: 200,left: 200),
      width: 200,
      height: 200,
      color: MyColor.AppRed,
      child: new Column(
        children: <Widget>[
          Text("right view"),
          new Container(
            margin: EdgeInsets.only(top: 10,left: 10,right: 10),
            width: 100,
            height: 100,
            color: MyColor.AppFFFFFF,
            child: Image.network("https://www.baidu.com/img/bd_logo1.png?where=super",
              alignment: Alignment.center,
              fit: BoxFit.cover,
            ),

          ),
          new Container(
            margin: EdgeInsets.only(top: 10,left: 10,right: 10,bottom: 10),
//            width: 40,
            height: 30,
            color: MyColor.AppFFFFFF,
            child: Text("中新经纬客户端5月14日电 (张澍楠)14日24时，国内成品油新一轮调价窗口将开启。截至目前，国内油价已连续三轮搁浅，机构预计，本轮仍大概率触发保护机制而不作调整。"),
          ),
        ],
      ),
    );
  }
}